feat(call): emit explicit final run status and JSON output (#1139)#1198
Draft
l2ysho wants to merge 2 commits into
Draft
feat(call): emit explicit final run status and JSON output (#1139)#1198l2ysho wants to merge 2 commits into
l2ysho wants to merge 2 commits into
Conversation
`apify call` and `apify task run` started a cloud run and streamed logs, but gave no explicit final result — a run could start successfully yet finish FAILED, TIMED_OUT, or ABORTED with no clear signal. Agents and CI could not tell "run started" from "run succeeded". Add a shared `run-result` module that owns the final-status contract: - `getRunExitCode` maps terminal status to a process exit code (SUCCEEDED→0, ABORTED→3, TIMED-OUT→2, FAILED→the Actor's own exit code or 1). - `buildRunResultJson` produces the structured `--json` payload (ok, operation, actor, run.status, run.exitCode, storage, error.logTail, exitCode). - `printRunResultSummary` prints a human-readable final summary, including a Reason block with the last log lines on failure. - `finalizeRun` is the single entry point both commands funnel through. `apify task run` now waits for the run to finish, gains `--json`, and reports a status-derived exit code. Final-status presentation and exit-code handling move out of `runActorOrTaskOnCloud` into the commands. Failed, timed-out, and aborted runs now exit non-zero. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The final-status contract nests the run status under `run.status` and adds `ok`/`operation`/`exitCode`; update the runs lifecycle e2e to match instead of reading the old top-level `status`. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1139
apify callandapify task runstarted a cloud run and streamed logs, butgave no explicit final result — a run could start successfully yet finish
FAILED, TIMED_OUT, or ABORTED with no clear signal. Agents and CI could not
tell "run started" from "run succeeded".
Add a shared
run-resultmodule that owns the final-status contract:getRunExitCodemaps terminal status to a process exit code (SUCCEEDED→0,ABORTED→3, TIMED-OUT→2, FAILED→the Actor's own exit code or 1).
buildRunResultJsonproduces the structured--jsonpayload (ok, operation,actor, run.status, run.exitCode, storage, error.logTail, exitCode).
printRunResultSummaryprints a human-readable final summary, including aReason block with the last log lines on failure.
finalizeRunis the single entry point both commands funnel through.apify task runnow waits for the run to finish, gains--json, and reports astatus-derived exit code. Final-status presentation and exit-code handling move
out of
runActorOrTaskOnCloudinto the commands. Failed, timed-out, and abortedruns now exit non-zero.
Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com